<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/project/style.css">
        <link rel="stylesheet" href="css/zv_common.css">
        <style>
    .zv_noticebo{  border-bottom:1px solid #e5e5e5;}
    .zv_noticefont1{height:2.2em;line-height:2.2em;color:#fe0202;font-size:0.925em; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;}
    .zv_noticefont2{ height:2.2em;line-height:2.2em;color:#a3a3a3;}
    .zv_noticefont3{height:2.2em;line-height:2.2em;color:#a3a3a3; font-size:0.925em;width:6em;white-space:nowrap; overflow:hidden;  }
    .zv_noticefont5{ height:1.2em;line-height:1.2em;color:#a3a3a3;font-size:0.925em;}
        /*tab切换样式*/
    .uinn-hnfn2{
        padding:0.78em 0;
    }
    .t_info{
        width:80%;font-size: .8em;height:2.4em;line-height: 1.2em;color:#7E7878;padding-left: 3%;
    }
    .t_date{
        width:12%;color:#7E7878;padding-left: 3%;font-size: .8em;text-align: right;padding-right: 2%;
    }
    .tm{
        width:96%;margin:0 auto;border-bottom:.0625em solid #64646B;padding-top: .4em;
    }
    .ims{
       color:#a3a3a3 ;max-width: 20%;height:3.8em;;min-width: 14%;line-height: 3.8em;font-size: .8em;
    }
    /*
 以上样式同notice-content.html样式
*/
    .zv_noticefont4{height:2em;line-height:2em;color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:bolder;font-size:0.85em;}
    </style>
    </head>
    <body class="um-vp " ontouchstart style=";">
        <div id="page_2">
            <div id="" style="color:red;font-size: .7em;padding: 0 .5em 1em;border-bottom: 1px dashed #000;">
                目前本功能只包含：请休假申请、培训考试、航前必读、部门通告、必读通知。
            </div>
            <div id="time_0" style="width:6em"></div>
            <div id="big">
              
            </div>
        </div>
        <input type="hidden" id="pageNum1" value="1">
        <input type="hidden" id="pageNum2" value="1">
    </body>
    <script src="js/appcan.js"></script>
    <script src="js/appcan.control.js"></script>
    <script src="js/common.js"></script>
    <script src="js/talkingdata.js"></script>
    </body>
    <script>
        appcan.ready(function() {
             IC.talkingDataCount("地服代办","0205"); 
             appcan.window.openToast("正在加载...",-1,5,0);
             returnjson();
             appcan.locStorage.setVal("yddf_kaoshiName",'');
             appcan.locStorage.setVal("yddf_examId",'');      
             appcan.locStorage.setVal("yddf_paperId",'');   
             appcan.locStorage.setVal("yddf_creatorId",'');
             localStorage.setItem("yddf_qxjName",'');
             localStorage.setItem("yddf_qxjContentId",'');
             localStorage.setItem("yddf_bmtgName",'');
             localStorage.setItem("yddf_bmtgContentId",'');
        });
        function returnjson(){
            IC.talkingDataCount("地服代办","0205"); 
            var username = localStorage['MU30-lOGIN-USRNAME'];
            //username="chengcheng1";
            var url=h_yddfUrl+"yddfMAS/h_portalUserDutyWebService?userName="+username;
            console.log(url);
            $.ajax({
                url:url,
                type:"GET",
                dataType:"json",
                success:function(data){
                    appcan.window.closeToast();
                    console.log(typeof(data.queryUserDutys));
                    var obj=JSON.parse(data.queryUserDutys);
                    var w = document.body.offsetWidth;
                    var zv_noticefont3w = document.getElementById("time_0").offsetWidth;
                    var titleW = w-zv_noticefont3w;
                    //obj = strToJson(obj);
                    var objdata = obj.userDutys;
                    var strx = "";      
                    for(var i=0;i<objdata.length;i++)   
                     {      
                            var CreateDate = objdata[i].createTime.time;
                            var at = new Date(CreateDate);
                            var year  = String(at.getFullYear());   
                            var month  = String(at.getMonth()+1);
                            var date  = String(at.getDate()); 
                            if(month<10)
                            {
                                month=0+''+month
                            }
                            if(date<10)
                            {
                                date=0+''+date
                            }
                            CreateDate=year+'/'+month+'/'+date
                            var sdk="11345717";
                            var name=objdata[i].dutyType;
                            var paperId="";
                            if(name=="考试"){
                                paperId=objdata[i].url.split("=");
                                paperId=paperId[2];
                            }
                            if(name=="考试"||name=="请休假申请"||name=="部门通告"||name=="航前必读"||name=="必读通知"){
                                strx += '<div class="ub uinn umh2 zv_noticebo" ontouchstart="zy_touch(\'zvbtn-act\')" style=" z-index:1" onclick=opentct("'+name+'","'+objdata[i].dutyId+'","'+paperId+'","'+objdata[i].creatorId+'")>'
                                strx += '<div class="ub-f2  ub ub-ver">'
                                strx += '<div class=" zv_noticefont1" style="width:'+titleW+'px;color:#000;font-weight: 650;">'+objdata[i].dutyName+'</div>'
                                strx +='<div class="zv_noticefont5">'+objdata[i].dutyType+'</div>';
                                strx += '</div>'
                                strx += '<div id="time_'+i+'" class="ub-f1  tx-r  ulev-1 zv_noticefont3">'+CreateDate+'</div>'
                                strx += '</div>'
                            }
                     }
                     $("#big").html(strx);
                     if(objdata.length<1){
                          appcan.window.openToast("暂无数据...",4000,5,0);
                     }
                     if(obj.status!=0){
                         appcan.window.openToast("暂无数据...",4000,5,0);
                     }
                },error:function(err){
                      appcan.window.closeToast();
                      appcan.window.openToast("服务器异常...",4000,5,0);
                      console.log(JSON.stringify(err));
                }
            })
        }
        function opentct(name,setid,paperId,creatorId){
           // IC.talkingDataCount("地服代办","0205"); 
             var sdk="11345717";
             var ht="";
              if(name=="考试"){
                     ht="fenshu";
                     appcan.locStorage.setVal("yddf_kaoshiName",name);
                     appcan.locStorage.setVal("yddf_examId",setid);      
                     appcan.locStorage.setVal("yddf_paperId",paperId);   
                     appcan.locStorage.setVal("yddf_creatorId",creatorId);
                     name="培训考试";
            }else if(name=="请休假申请"){
                     ht="applyList";
                     localStorage.setItem("yddf_qxjName",name);
                     localStorage.setItem("yddf_qxjContentId",setid);
            }else if(name=="部门通告"||name=="航前必读"||name=="必读通知"){
                     ht="BuMenTongGao";
                     localStorage.setItem("yddf_bmtgName",name);
                     localStorage.setItem("yddf_bmtgContentId",setid);
                     name="部门通告";
            }
            if(name=="内容修改"){
                return;
            }
             //yddf_examId
             //yddf_paperId "sdk10354","东航党建"
             //uexWindow.publishChannelNotification(1006, 'openTabByName("'+sdk+'","'+name+'","")');
            // uexWindow.publishChannelNotification(1006, 'openTabByName("sdk10354","东航党建","")');
             appcan.window.open({
                    name:ht,
                    dataType:0,
                    data:ht+'.html'
                })
        }
        function delcommission(dutyTpe,dutyId){
            IC.talkingDataCount("地服代办","0205"); 
              console.log(dutyTpe+dutyId);
              var username = localStorage['MU30-lOGIN-USRNAME'];
              //username="chengcheng1";
              var url=h_yddfUrl+"yddfMAS/h_doFinishDuty?userName="+username+"&dutyId="+dutyId+"&dutyTpe="+dutyTpe;
              $.ajax({
                  url:url,
                  type:"GET",
                  dataType:"json",
                  success:function(data){
                      console.log(data);
                      returnjson();
                  },error:function(err){
                      console.log(err);
                  }
              })
         }
    </script>
</html>
